{load_language_text section="google_categories_administration"}
<div class="template_properties_edit">
	<div class="template_properties_edit_content">	
				
		{foreach item=item_array from=$content_data.properties_data.PROPERTIES_NAMES_FIELDS name=properties_names}	
			<p>
				<label for="properties_name[{$item_array.code}]">Name ({$item_array.code}):</label>
				<input id="properties_name[{$item_array.code}]" name="properties_name[{$item_array.code}]" type="text" value="{$item_array.properties_name}" size="20" />
			</p>
                        <p>
				<label for="properties_admin_name[{$item_array.code}]">Admin-Name ({$item_array.code}):</label>
				<input id="properties_admin_name[{$item_array.code}]" name="properties_admin_name[{$item_array.code}]" type="text" value="{$item_array.properties_admin_name}" size="20" />
			</p>
		{/foreach}
		
		
		<p>
			<label for="properties_sort_order">Sortiernummer:</label>
			<input id="properties_sort_order" name="properties_sort_order" type="text" value="{$content_data.properties_data.sort_order}" size="4" />
		</p>
	</div>
	<div><a href="#" class="button cancel" style="float: left;">{$txt.button_cancel}</a><a href="#" class="button save" style="float: right;">{$txt.button_save}</a><div style="clear: both;"> <!-- --> </div></div>
</div>
{literal}
<style>
	.template_properties_edit label{
		width: 120px;
		height: 24px;
		line-height: 24px;
		display: block;
		float: left;
		cursor: pointer;
	}
	
	.template_properties_edit input{
		width: 435px;
		height: 24px;
		line-height: 22px;
		display: block;
		padding: 0px;
		margin: 0px;
		border: 1px solid #ccc;
		font-size: 12px;
	}
</style>

<script type="text/javascript">
	$(document).ready(function(){	
		if("${properties_id}" == ""){
			$(".lightbox_package_header").html("Eigenschaft hinzuf&uuml;gen");
		}else{
			$(".lightbox_package_header").html("Eigenschaft bearbeiten");
		}
		
		$(".cancel").bind("click", function(){
			lightbox_close();
			return false;
		});
		
		$(".save").bind("click", function(){
			var inputs = [];
			$('.template_properties_edit_content input').each(function() 
			{
				inputs.push(this.name + '=' + escape(this.value));
			});
			inputs.push("properties_id=${properties_id}");
			$.ajax({
				data: 		inputs.join('&'),
				url: 		"request_port.php?module=properties_admin&action=save&type=properties",
				type: 		"POST",
				timeout: 	2000,
				dataType:	"text",
				error: 		function(){ if(fb)console.log('error'); },
				success: 	function(p_result)
							{ 
								var t_table_container = $("#properties_table_container_"+p_result);
								t_table_container.remove();
								var t_added = false;		
								$.each($(".properties_table_container"), function(t_container_key, t_container_value){				
									if(parseInt($(".properties_sort_order_value" ,this).html()) > parseInt($("#properties_sort_order").val()) && t_added == false){
										$(this).before('<div id="properties_table_container_'+p_result+'"></div>');
										t_added = true;
									}
								});
								if(t_added == false){
									$("#properties_area_content").append('<div id="properties_table_container_'+p_result+'"></div>');
								}
								$(".properties_table_container").removeClass("active");
								$('#properties_table_container_'+p_result).addClass('properties_table_container').addClass("active");
								$('#properties_table_container_' + p_result).load(
																					'request_port.php?module=properties_admin&action=load&type=properties_table&properties_id=' + p_result, 
																					function() {
																						if(fb)console.log('loaded: properties_table_container_' + p_result);
																					}
																				);
								lightbox_close();
							}
			});
			return false;
		});
	});
</script>
{/literal}